package externalflame.systemdesign.newsfeed.controller;


import externalflame.systemdesign.newsfeed.service.FriendService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "friends")
public class FriendController {

    @Autowired
    FriendService friendService;

    @ApiOperation("关注")
    @PutMapping(value = "/follow", produces = "application/json")
    public String follow(@RequestHeader Long userId, @RequestParam Long toUserId) {
        return friendService.follow(userId, toUserId);
    }

    @ApiOperation("取消关注")
    @PutMapping(value = "/unfollow", produces = "application/json")
    public String unfollow(@RequestHeader Long userId, @RequestParam Long toUserId) {
        return friendService.unfollow(userId, toUserId);
    }
}
